﻿using System;
using System.Collections;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;

public partial class servertests : System.Web.UI.Page
{
    StringBuilder sbResults = new StringBuilder();

    protected void Page_Load(object sender, EventArgs e)
    {
        TestFileDefinition();

        content.Text = sbResults.ToString();
    }

    private void ReportResult(string testName, bool success, string notes)
    {
        if (success)
            sbResults.AppendFormat("<div style=\"background-color: #8f8;\"><b>Succeeded:</b> {0}<br/>{1}<br/></div>", testName, (notes == null) ? String.Empty : notes);
        else
            sbResults.AppendFormat("<div style=\"background-color: #f88;\"><b>Failed:</b> {0}<br/>{1}<br/></div>", testName, (notes == null) ? String.Empty : notes);
    }

    private void TestFileDefinition()
    {
        DataFileDefinition dfd = new DataFileDefinition(Ethnicity.White, Field.Age, "Test file");
        dfd.Test(new TestResultDelegate(ReportResult));
    }
}
